import api from '@/axios.js';

export function getAllGames() {
    return api({
        method: 'get',
        url: '/games/getAll'
    })
        .then(response => {
            return response.data;
        })
        .catch(error => {
            console.error("获取游戏列表失败: ", error);
            throw error;
        });
}

export function getGameById(id) {
    return api({
        method: 'get',
        url: `/games/${id}`
    })
        .then(response => {
            return response.data;
        })
        .catch(error => {
            console.error("获取游戏信息失败: ", error);
            throw error;
        });
}
